package ac.il.technion.cs236635.project.core;

import java.util.Random;

public class Utility {

	public static double genNextExp( double rate, long interval, int serversNum) {
		Random rnd = new Random( );
		double uniform = rnd.nextDouble( );
		double result = Math.log( 1 - uniform) * (- rate) / serversNum;
		
		return result * interval;
	}
	
	public static void main(String[] args) {
		double result = 0; 
		for ( int i = 0; i < 5; ++i) {
			double num = genNextExp( 1, 2000, 5);
			result += num;
			System.out.println( num );
		}
		System.out.println( "Mean: " + result / 5);
	}
}
